package org.aiforum.frountend.dao;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import org.aiforum.domain.Plate;
import org.springframework.stereotype.Repository;

/**
 * 板块持久化实现类
 * @author VIC
 *
 */
@Repository("plateDao")
public class PlateDaoImpl implements PlateDao {
	
	/**
	 * 使用@PersistenceContext注解标注属性时,Spring会自动创建并注入实体管理器
	 */
	@PersistenceContext
	private EntityManager entityManager;

	@Override
	public List<Plate> queryPlateByState(int plateState) {
		Query query = entityManager.createNamedQuery("queryPlateByState");
		query.setParameter("plateState", plateState);
		return query.getResultList();
	}

}
